using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TestCases.Assertions
{
    public class MSTestAssertion : IAssertion
    {
        private readonly TestContext _context;

        public MSTestAssertion()
        {
        }

        public MSTestAssertion(TestContext context)
        {
            _context = context;
        }

        public void Fail(string message)
        {
            throw new AssertFailedException(message);
        }

        public void Trace(string message)
        {
            if (_context == null)
            {
                System.Diagnostics.Trace.WriteLine(message);
            }
            else
            {
                _context.WriteLine(message);
            }
        }
    }
}